package com.robinmouren.utils;


import java.time.LocalDateTime;

/**
 * 处理日期时间工具
 * @author Robinmouren
 */
public class DateUtils {


    /**
     * 判断开始时间是否在结束时间之前
     * @param startTime
     * @param endTime
     * @return
     */
    public static boolean ifStartAndEndSpecification(LocalDateTime startTime, LocalDateTime endTime){
         return startTime.compareTo(endTime) < 0;
    }


    /**
     * 判断两段时间是否有重叠
     * @param start1
     * @param end1
     * @param start2
     * @param end2
     * @return
     */
    public static boolean ifTimeHasChengHsien(LocalDateTime start1,LocalDateTime end1,
                                              LocalDateTime start2,LocalDateTime end2){

        return (start1.isBefore(start2) && end1.isAfter(start2)) ||
                (start1.isBefore(end1) && end1.isAfter(end2));
    }
}
